if {"::tcltest" ni [namespace children]} {
	package require tcltest
	namespace import ::tcltest::*
}

package require rl_json
namespace path {::rl_json}

test get-1.1 {Get a value from an object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} foo
} -result bar
#>>>
test get-2.1 {Get a value from an object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz
} -result [list str 123 123.4 1 0 "" {inner obj}]
#>>>
test get-3.1 {Get a value from a nested object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz": {
				"query": "filtered"
			}
		}
	} baz query
} -result filtered
#>>>
test get-4.1 {Get a value from an array} -body { #<<<
	json get {["a", "b", "c", "d"]} 2
} -result c
#>>>
test get-4.4 {Get an index from an array relative to the end} -body { #<<<
	json get {["a", "b", "c", "d"]} end
} -result d
#>>>
test get-4.5 {Get an index from an array relative to the end} -body { #<<<
	json get {["a", "b", "c", "d"]} end-2
} -result b
#>>>
test get-4.6 {Get an index from an array relative to the end} -body { #<<<
	json get {["a", "b", "c", "d"]} end-4
} -result ""
#>>>
test get-5.1 {Get a value from an array in an object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 2
} -result 123.4
#>>>
test get-6.1 {get of a toplevel value} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	}
} -result [dict create foo bar baz [list str 123 123.4 1 0 "" [dict create inner obj]]]
#>>>
test get-7.1 {get for invalid value - empty string} -body { #<<<
	json get {} foo
} -returnCodes error -result {Error parsing JSON value: No JSON value found at offset 0}
#>>>
test get-7.2 {get for invalid value - truncated object} -body { #<<<
	json get "\{\"foo\":\"bar\"" foo
} -returnCodes error -result {Error parsing JSON value: Unterminated object at offset 0}
#>>>
test get-7.3 {get for invalid value - truncated array} -body { #<<<
	json get {["foo", "bar"} 1
} -returnCodes error -result {Error parsing JSON value: Unterminated array at offset 0}
#>>>
test get-7.4 {get for invalid value - truncated string} -body { #<<<
	json get {"foo} foo
} -returnCodes error -result {Error parsing JSON value: Document truncated at offset 4}
#>>>
test get-7.5 {get for invalid value - truncated boolean: true} -body { #<<<
	json get {tru} foo
} -returnCodes error -result {Error parsing JSON value: Illegal character at offset 0}
#>>>
test get-7.6 {get for invalid value - truncated boolean: false} -body { #<<<
	json get {fals} foo
} -returnCodes error -result {Error parsing JSON value: Illegal character at offset 0}
#>>>
test get-7.7 {get for invalid value - truncated null} -body { #<<<
	json get {nul} foo
} -returnCodes error -result {Error parsing JSON value: Illegal character at offset 0}
#>>>

# Modifiers - ?type
test get-20.1 {type modifier, string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} foo ?type
} -result string
#>>>
test get-20.2 {type modifier, array} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz ?type
} -result array
#>>>
test get-20.3 {type modifier, number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 1 ?type
} -result number
#>>>
test get-20.4 {type modifier, boolean} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 3 ?type
} -result boolean
#>>>
test get-20.5 {type modifier, null} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 5 ?type
} -result null
#>>>
test get-20.6 {type modifier, object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 6 ?type
} -result object
#>>>
test get-20.7 {type modifier, template subst: string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~S:dynamic"
		}
	} something ?type
} -result string
#>>>
test get-20.8 {type modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~N:dynamic"
		}
	} something ?type
} -result string
#>>>
test get-20.9 {type modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~B:dynamic"
		}
	} something ?type
} -result string
#>>>
test get-20.10 {type modifier, template subst: literal} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~L:dynamic"
		}
	} something ?type
} -result string
#>>>
test get-20.11 {type modifier, template subst: json doc} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~J:dynamic"
		}
	} something ?type
} -result string
#>>>
test get-20.12 {type modifier, template subst: json template} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~T:dynamic"
		}
	} something ?type
} -result string
#>>>
test get-20.13 {type modifier, template subst: invalid} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~X:dynamic"
		}
	} something ?type
} -result string
#>>>

# Modifiers - ?length
test get-21.1 {length modifier, string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} foo ?length
} -result 3
#>>>
test get-21.2 {length modifier, array} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz ?length
} -result 7
#>>>
test get-21.3 {length modifier, number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 1 ?length
} -returnCodes error -result {?length modifier is not supported for type number}
#>>>
test get-21.4 {length modifier, boolean} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 3 ?length
} -returnCodes error -result {?length modifier is not supported for type boolean}
#>>>
test get-21.5 {length modifier, null} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 5 ?length
} -returnCodes error -result {?length modifier is not supported for type null}
#>>>
test get-21.6 {length modifier, object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 6 ?length
} -returnCodes error -result {?length modifier is not supported for type object}
#>>>
test get-21.7 {length modifier, template subst: string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~S:dynamic"
		}
	} something ?length
} -result 10
#>>>
test get-21.8 {length modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~N:dynamic"
		}
	} something ?length
} -result 10
#>>>
test get-21.9 {length modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~B:dynamic"
		}
	} something ?length
} -result 10
#>>>
test get-21.10 {length modifier, template subst: literal} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~L:dynamic"
		}
	} something ?length
} -result 10
#>>>
test get-21.11 {length modifier, template subst: json doc} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~J:dynamic"
		}
	} something ?length
} -result 10
#>>>
test get-21.12 {length modifier, template subst: json template} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~T:dynamic"
		}
	} something ?length
} -result 10
#>>>
test get-21.13 {length modifier, template subst: invalid} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~X:dynamic"
		}
	} something ?length
} -result 10
#>>>

# Modifiers - ?size
test get-22.1 {size modifier, string} -body { #<<<
	json get {
		{
			"foo": "bar x",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} foo ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.2 {size modifier, array} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz ?size
} -returnCodes error -result {?size modifier is not supported for type array}
#>>>
test get-22.3 {size modifier, number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 1 ?size
} -returnCodes error -result {?size modifier is not supported for type number}
#>>>
test get-22.4 {size modifier, boolean} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 3 ?size
} -returnCodes error -result {?size modifier is not supported for type boolean}
#>>>
test get-22.5 {size modifier, null} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 5 ?size
} -returnCodes error -result {?size modifier is not supported for type null}
#>>>
test get-22.6 {size modifier, object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj", "x": "y", "z": null}]
		}
	} baz 6 ?size
} -result 3
#>>>
test get-22.7 {size modifier, template subst: string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~S:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.8 {size modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~N:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.9 {size modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~B:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.10 {size modifier, template subst: literal} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~L:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.11 {size modifier, template subst: json doc} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~J:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.12 {size modifier, template subst: json template} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~T:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>
test get-22.13 {size modifier, template subst: invalid} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~X:dynamic"
		}
	} something ?size
} -returnCodes error -result {?size modifier is not supported for type string}
#>>>

# Modifiers - ?keys
test get-23.1 {keys modifier, string} -body { #<<<
	json get {
		{
			"foo": "bar x",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} foo ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.2 {keys modifier, array} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz ?keys
} -returnCodes error -result {?keys modifier is not supported for type array}
#>>>
test get-23.3 {keys modifier, number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 1 ?keys
} -returnCodes error -result {?keys modifier is not supported for type number}
#>>>
test get-23.4 {keys modifier, boolean} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 3 ?keys
} -returnCodes error -result {?keys modifier is not supported for type boolean}
#>>>
test get-23.5 {keys modifier, null} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}]
		}
	} baz 5 ?keys
} -returnCodes error -result {?keys modifier is not supported for type null}
#>>>
test get-23.6 {keys modifier, object} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj", "x": "y", "z": null}]
		}
	} baz 6 ?keys
} -result {inner x z}
#>>>
test get-23.7 {keys modifier, template subst: string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~S:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.8 {keys modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~N:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.9 {keys modifier, template subst: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~B:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.10 {keys modifier, template subst: literal} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~L:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.11 {keys modifier, template subst: json doc} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~J:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.12 {keys modifier, template subst: json template} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~T:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>
test get-23.13 {keys modifier, template subst: invalid} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": "~X:dynamic"
		}
	} something ?keys
} -returnCodes error -result {?keys modifier is not supported for type string}
#>>>

test get-50.1 {escaping a modifier} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} something ??type
} -result fromdoc
#>>>

# Invalid paths
test get-60.1 {invalid path: missing key} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} blah
} -returnCodes error -result {Path element 2: "blah" not found}
#>>>
test get-60.2 {invalid path: subscribed atomic: string} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.3 {invalid path: subscribed atomic: number} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz 1 blah
} -returnCodes error -result {Cannot descend into atomic type "number" with path element 3: "blah"}
#>>>
test get-60.4 {invalid path: subscribed atomic: boolean} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz 3 blah
} -returnCodes error -result {Cannot descend into atomic type "boolean" with path element 3: "blah"}
#>>>
test get-60.5 {invalid path: subscribed atomic: null} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz 5 blah
} -returnCodes error -result {Cannot descend into atomic type "null" with path element 3: "blah"}
#>>>
test get-60.6 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz blah
} -returnCodes error -result {Expected an integer index or end(-integer)?, got blah}
#>>>
test get-60.7 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz end-12
} -result ""
#>>>
test get-60.8 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz 100
} -result ""
#>>>
test get-60.9 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz -2
} -result ""
#>>>
test get-60.10 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz end-2foo
} -returnCodes error -result {Expected an integer index or end(-integer)?, got end-2foo}
#>>>
test get-60.11 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz end-foo
} -returnCodes error -result {Expected an integer index or end(-integer)?, got end-foo}
#>>>
test get-60.12 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz end2
} -returnCodes error -result {Expected an integer index or end(-integer)?, got end2}
#>>>
test get-60.13 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz end+2
} -returnCodes error -result {Expected an integer index or end(-integer)?, got end+2}
#>>>
test get-60.14 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz "end- 2"
} -returnCodes error -result {Expected an integer index or end(-integer)?, got end- 2}
#>>>
test get-60.15 {invalid path: invalid array index} -body { #<<<
	json get {
		{
			"foo": "bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz end-
} -returnCodes error -result {Expected an integer index or end(-integer)?, got end-}
#>>>
test get-60.16 {invalid path: subscribed atomic: template string} -body { #<<<
	json get {
		{
			"foo": "~S:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.17 {invalid path: subscribed atomic: template number} -body { #<<<
	json get {
		{
			"foo": "~N:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.18 {invalid path: subscribed atomic: template boolean} -body { #<<<
	json get {
		{
			"foo": "~B:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.19 {invalid path: subscribed atomic: template json doc} -body { #<<<
	json get {
		{
			"foo": "~J:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.20 {invalid path: subscribed atomic: template json template} -body { #<<<
	json get {
		{
			"foo": "~T:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.21 {invalid path: subscribed atomic: template literal} -body { #<<<
	json get {
		{
			"foo": "~L:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.22 {invalid path: subscribed atomic: template invalid} -body { #<<<
	json get {
		{
			"foo": "~X:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} foo blah
} -returnCodes error -result {Cannot descend into atomic type "string" with path element 2: "blah"}
#>>>
test get-60.23 {invalid path: subscribed atomic: template invalid} -body { #<<<
	json get {
		{
			"foo": "~X:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz en
} -returnCodes error -result {Expected an integer index or end(-integer)?, got en}
#>>>
test get-60.24 {invalid path: subscribed atomic: template invalid} -body { #<<<
	json get {
		{
			"foo": "~X:bar",
			"baz":  ["str", 123, 123.4, true, false, null, {"inner": "obj"}],
			"something": {
				"?type": "fromdoc"
			}
		}
	} baz foo
} -returnCodes error -result {Expected an integer index or end(-integer)?, got foo}
#>>>
test get-60.25 {Get a template point} -body { #<<<
	json get {
		{
			"foo": "~S:bar"
		}
	} foo
} -result {~S:bar}
#>>>

::tcltest::cleanupTests
return

# vim: ft=tcl foldmethod=marker foldmarker=<<<,>>> ts=4 shiftwidth=4
